#pragma once

#include <comdef.h>
#include <atlstr.h>

#include <boost/noncopyable.hpp>
#include <boost/smart_ptr.hpp>

#include "tstd.h"

namespace GPCommon
{

_bstr_t LoadResourceBSTR(UINT id);
tstd::tstring LoadResourceString(UINT id);
GrymCore::IRasterPtr LoadResourceRaster(GrymCore::IGrymObjectFactory *pFactory, UINT rcid_png);

void StringReplace(std::string &source, const std::string &lookup, const std::string &replace);
void StringReplace(std::wstring &source, const std::wstring &lookup, const std::wstring &replace);
std::string HTMLMakeEscaped(const std::string &orig);
std::wstring HTMLMakeEscaped(const std::wstring &orig);
std::string HTMLUnescape(const std::string &orig);
std::wstring HTMLUnescape(const std::wstring &orig);

#pragma warning(push)
#pragma warning(disable: 4311 4312)

template <class TSrc>
OLE_HANDLE to_ole_handle_cast(TSrc hsrc)
{
	return reinterpret_cast<OLE_HANDLE>(hsrc);
}

template <class TDst>
TDst from_ole_handle_cast(OLE_HANDLE hsrc)
{
	return reinterpret_cast<TDst>(hsrc);
}
#pragma warning(pop)

tstd::tstring GetUserDataPath(const tstd::tstring &tail);

} // namespace GPCommon

